using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace ICP_MS.Plugin.Experiment;

public class FormConcentration : Form
{
	private ExperimentDatas experiment = null;

	private ExperimentDB db = null;

	private ComboBox box = null;

	private IContainer components = null;

	private DbufferGrid dgvSA;

	private TabControl tabControl1;

	private TabPage pageFQ;

	private TabPage pageSA;

	private DbufferGrid dgvFQ;

	private TabPage pageQC;

	private GroupBox groupBox1;

	private NumericUpDown nudHigh;

	private Label label2;

	private NumericUpDown nudLow;

	private Label label1;

	private GroupBox gbQCCon;

	private DbufferGrid dgvQCS;

	private GroupBox groupBox2;

	private RadioButton rdbtnManual;

	private RadioButton rdBtnAuto;

	private TabPage pageSM;

	private DbufferGrid dgvSM;

	public FormConcentration()
	{
		InitializeComponent();
	}

	public void SetParams(ExperimentDatas experiment, ExperimentDB db)
	{
		this.experiment = experiment;
		this.db = db;
	}

	private void experiment_isotopeChanged(object sender, EventArgs e)
	{
		InitDtSamples();
		experiment.FillStdConcentration();
		BindStdConcentration();
		experiment.Dirty.STDConcDirty = true;
	}

	private void experiment_istdChanged(object sender, EventArgs e)
	{
		InitDtSamples();
		experiment.FillStdConcentration();
		BindStdConcentration();
		experiment.Dirty.STDConcDirty = true;
	}

	public void experiment_methodChanged(object sender, EventArgs e)
	{
		InitDtSamples();
		experiment.FillStdConcentration();
		BindStdConcentration();
		experiment.Dirty.STDConcDirty = true;
	}

	private void experiment_sampleChanged(object sender, EventArgs e)
	{
		experiment.FillStdConcentration();
		BindStdConcentration();
		experiment.Dirty.STDConcDirty = true;
	}

	private void BindStdConcentration()
	{
		BindFQConcentration();
		BindSMConcentration();
		BindSAConcentration();
		BindQCSConcentration();
	}

	private void InitDtSamples()
	{
		InitFQHeader();
		InitSMHeader();
		InitSAHeader();
		InitQCSHeader();
	}

	private void InitQCSPara()
	{
		nudLow.Value = (int)(experiment.QCS.lowLimit * 100.0);
		nudHigh.Value = (int)(experiment.QCS.highLimit * 100.0);
		rdBtnAuto.Checked = experiment.QCS.method == 0;
		rdbtnManual.Checked = experiment.QCS.method == 1;
	}

	private void FormConcentration_Load(object sender, EventArgs e)
	{
		base.WindowState = FormWindowState.Maximized;
		ApplyResources();
		dgvFQ.VerCopy = true;
		dgvFQ.HorCopy = true;
		dgvSA.VerCopy = true;
		dgvSA.HorCopy = true;
		dgvSM.VerCopy = true;
		dgvSM.HorCopy = true;
		InitDtSamples();
		InitQCSPara();
		experiment.FillStdConcentration();
		BindStdConcentration();
		experiment.isotopeChanged += experiment_isotopeChanged;
		experiment.istdChanged += experiment_istdChanged;
		experiment.sampleChanged += experiment_sampleChanged;
		experiment.methodChanged += experiment_methodChanged;
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormConcentration.Title.Text");
		pageFQ.Text = Lang.Txt("FormConcentration.PageFQ.Text");
		pageQC.Text = Lang.Txt("FormConcentration.PageQCSetting.Text");
		pageSA.Text = Lang.Txt("FormConcentration.PageSA.Text");
		label1.Text = Lang.Txt("FormConcentration.LowExtend.Text");
		label2.Text = Lang.Txt("FormConcentration.HighExtend.Text");
		groupBox1.Text = Lang.Txt("FormConcentration.GroupBox.QCExtent.Text");
		groupBox2.Text = Lang.Txt("FormConcentration.GroupBox.ExceedProcess.Text");
		gbQCCon.Text = Lang.Txt("FormConcentration.GroupBox.QCConcentration.Text");
		rdBtnAuto.Text = Lang.Txt("FormConcentration.ExceedProcess1.Text");
		rdbtnManual.Text = Lang.Txt("FormConcentration.ExceedProcess2.Text");
		pageSM.Text = Lang.Txt("FormCalibration.Columns.SemiQuant.Text");
	}

	private void FormConcentration_FormClosing(object sender, FormClosingEventArgs e)
	{
		experiment.isotopeChanged -= experiment_isotopeChanged;
		experiment.istdChanged -= experiment_istdChanged;
		experiment.sampleChanged -= experiment_sampleChanged;
		experiment.methodChanged -= experiment_methodChanged;
	}

	private void dgvStdConcentration_CellValueChanged(object sender, DataGridViewCellEventArgs e)
	{
		int rowIndex = e.RowIndex;
		int colIndex = e.ColumnIndex;
		DataGridView dgv = sender as DataGridView;
		if (rowIndex > 0 && colIndex > 1 && !dgv.Columns[colIndex].ReadOnly)
		{
			try
			{
				double value = Convert.ToDouble(dgv[colIndex, rowIndex].Value);
				int id = Convert.ToInt32(dgv[0, rowIndex].Value);
				string symbol = dgv.Columns[colIndex].HeaderText;
				IEnumerable<StandardConcentration> tmp = experiment.StdConcentration.Where((StandardConcentration std) => std.symbol == symbol && std.sample == id);
				tmp.ElementAt(0).concentration = value;
				dgv[colIndex, rowIndex].Style.ForeColor = Color.Black;
				if (CreateGraphics().MeasureString(double.Parse(dgv[colIndex, rowIndex].Value.ToString()).ToString("#.000"), dgv.DefaultCellStyle.Font).Width > (float)(dgv.Columns[colIndex].Width - 5))
				{
					dgv.Columns[colIndex].Width = (int)CreateGraphics().MeasureString(double.Parse(dgv[colIndex, rowIndex].Value.ToString()).ToString("#.000"), dgv.DefaultCellStyle.Font).Width + 5;
				}
			}
			catch
			{
				dgv[colIndex, rowIndex].Style.ForeColor = Color.Red;
			}
		}
		experiment.Dirty.STDConcDirty = true;
	}

	private void dgvStdConcentration_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
	{
		int rowIndex = e.RowIndex;
		int colIndex = e.ColumnIndex;
		DataGridView dgv = sender as DataGridView;
		if (rowIndex <= 0 || colIndex <= 1)
		{
			return;
		}
		if (dgv.Columns[colIndex].ReadOnly)
		{
			e.Value = "NA";
			return;
		}
		try
		{
			double value = Convert.ToDouble(e.Value);
			if (value < 0.0)
			{
				e.Value = "";
			}
			else
			{
				e.Value = Convert.ToDouble(e.Value).ToString("F3");
			}
		}
		catch
		{
			e.Value = -1;
		}
	}

	private void dgvStdConcentration_CurrentCellChangedBak(object sender, EventArgs e)
	{
		DataGridView dgv = sender as DataGridView;
		if (dgv.CurrentCell == null)
		{
			return;
		}
		int rowIndex = dgv.CurrentCell.RowIndex;
		int columnIndex = dgv.CurrentCell.ColumnIndex;
		if (columnIndex != 1 || dgv.Rows[rowIndex].ReadOnly)
		{
			return;
		}
		box = new ComboBox();
		box.Parent = dgv;
		box.DropDownStyle = ComboBoxStyle.DropDownList;
		Rectangle rect = dgv.GetCellDisplayRectangle(columnIndex, rowIndex, cutOverflow: false);
		box.Left = rect.Left;
		box.Top = rect.Top;
		box.Width = rect.Width;
		box.Height = rect.Height;
		box.Visible = true;
		box.Items.Add("ppb");
		box.Items.Add("ppq");
		box.Items.Add("ppt");
		box.Items.Add("ppm");
		box.Items.Add("%");
		string oldUnits = dgv.CurrentCell.Value.ToString();
		box.SelectedItem = oldUnits;
		string newUnits = oldUnits;
		box.DropDown += delegate
		{
			oldUnits = dgv.CurrentCell.Value.ToString();
		};
		box.SelectedIndexChanged += delegate
		{
			newUnits = box.SelectedItem.ToString();
			if (newUnits != oldUnits)
			{
				string symbol = "";
				if (dgv.Equals(dgvFQ))
				{
					symbol = dgv.Rows[rowIndex].Cells[0].Value.ToString();
				}
				else
				{
					symbol = dgv.Columns[columnIndex].HeaderText;
				}
				IEnumerable<IsotopeInfos> enumerable = experiment.Isotopes.Where((IsotopeInfos isotope) => isotope.symbol.Contains(symbol));
				IEnumerable<StandardConcentration> enumerable2 = experiment.StdConcentration.Where((StandardConcentration std) => std.symbol.Contains(symbol));
				if (enumerable != null && enumerable.Count() > 0 && enumerable2 != null && enumerable2.Count() > 0)
				{
					foreach (IsotopeInfos current in enumerable)
					{
						current.units = box.SelectedItem.ToString();
					}
					dgv.CurrentCell.Value = box.SelectedItem.ToString();
					foreach (StandardConcentration current2 in enumerable2)
					{
						double num = current2.concentration;
						switch (oldUnits)
						{
						case "%":
							num *= Math.Pow(10.0, 7.0);
							break;
						case "ppm":
							num *= Math.Pow(10.0, 3.0);
							break;
						case "ppb":
							num *= 1.0;
							break;
						case "ppt":
							num *= Math.Pow(10.0, -3.0);
							break;
						case "ppq":
							num *= Math.Pow(10.0, -6.0);
							break;
						}
						switch (newUnits)
						{
						case "%":
							num *= Math.Pow(10.0, -7.0);
							break;
						case "ppm":
							num *= Math.Pow(10.0, -3.0);
							break;
						case "ppb":
							num *= 1.0;
							break;
						case "ppt":
							num *= Math.Pow(10.0, 3.0);
							break;
						case "ppq":
							num *= Math.Pow(10.0, 6.0);
							break;
						}
						current2.concentration = num;
					}
					if (dgv.Equals(dgvFQ))
					{
						BindFQConcentration();
					}
					else
					{
						BindSAConcentration();
					}
				}
			}
		};
	}

	private void dgvStdConcentration_CurrentCellChanged(object sender, EventArgs e)
	{
		DataGridView dgv = sender as DataGridView;
		if (dgv.CurrentCell == null)
		{
			return;
		}
		int rowIndex = dgv.CurrentCell.RowIndex;
		int columnIndex = dgv.CurrentCell.ColumnIndex;
		if (rowIndex != 0 || dgv.Columns[columnIndex].ReadOnly)
		{
			return;
		}
		box = new ComboBox();
		box.Parent = dgv;
		box.DropDownStyle = ComboBoxStyle.DropDownList;
		Rectangle rect = dgv.GetCellDisplayRectangle(columnIndex, rowIndex, cutOverflow: false);
		box.Left = rect.Left;
		box.Top = rect.Top;
		box.Width = rect.Width;
		box.Height = rect.Height;
		box.Visible = true;
		box.Items.Add("mg/mL");
		box.Items.Add("mg/L");
		box.Items.Add("mg/g");
		box.Items.Add("mg/kg");
		box.Items.Add("ug/mL");
		box.Items.Add("ug/L");
		box.Items.Add("ug/g");
		box.Items.Add("ug/kg");
		box.Items.Add("ng/mL");
		box.Items.Add("ng/L");
		box.Items.Add("ng/g");
		box.Items.Add("ng/kg");
		box.Items.Add("ppm");
		box.Items.Add("ppb");
		box.Items.Add("ppt");
		box.Items.Add("%");
		string oldUnits = dgv.CurrentCell.Value.ToString();
		box.SelectedItem = oldUnits;
		string newUnits = oldUnits;
		box.DropDown += delegate
		{
			oldUnits = dgv.CurrentCell.Value.ToString();
		};
		box.SelectedIndexChanged += delegate
		{
			newUnits = box.SelectedItem.ToString();
			if (newUnits != oldUnits)
			{
				string symbol = dgv.Columns[columnIndex].HeaderText;
				IEnumerable<IsotopeInfos> enumerable = experiment.Isotopes.Where((IsotopeInfos isotope) => isotope.symbol.Contains(symbol));
				IEnumerable<StandardConcentration> enumerable2 = experiment.StdConcentration.Where((StandardConcentration std) => std.symbol.Contains(symbol));
				if (enumerable != null && enumerable.Count() > 0 && enumerable2 != null && enumerable2.Count() > 0)
				{
					foreach (IsotopeInfos current in enumerable)
					{
						current.units = box.SelectedItem.ToString();
					}
					enumerable.ElementAt(0).units = box.SelectedItem.ToString();
					dgv.CurrentCell.Value = box.SelectedItem.ToString();
					if (dgv.Equals(dgvFQ))
					{
						BindFQConcentration();
					}
					else
					{
						BindSAConcentration();
					}
				}
			}
		};
		experiment.Dirty.STDConcDirty = true;
	}

	private void dgvStdConcentration_CellLeave(object sender, DataGridViewCellEventArgs e)
	{
		if (box != null)
		{
			box.Dispose();
			box = null;
		}
	}

	private void BindFQConcentrationbak()
	{
		InitFQHeader();
		foreach (IsotopeInfos isotope in experiment.Isotopes)
		{
			if (isotope.method != 1)
			{
				continue;
			}
			bool IsExist = false;
			foreach (DataGridViewRow row in (IEnumerable)((DataGridView)(object)dgvFQ).Rows)
			{
				if (row.Cells[0].Value != null && isotope.symbol.Contains(row.Cells[0].Value.ToString()))
				{
					IsExist = true;
					break;
				}
			}
			if (IsExist)
			{
				continue;
			}
			string headertext = Regex.Replace(isotope.symbol, "[0-9]", "", RegexOptions.IgnoreCase);
			string units = "ppb";
			if (isotope.units != null)
			{
				units = isotope.units;
			}
			int rowIndex = ((DataGridView)(object)dgvFQ).Rows.Add();
			((DataGridView)(object)dgvFQ).Rows[rowIndex].Cells[0].Value = headertext;
			((DataGridView)(object)dgvFQ).Rows[rowIndex].Cells[1].Value = units;
			if (isotope.inter)
			{
				((DataGridView)(object)dgvFQ).Rows[rowIndex].DefaultCellStyle.BackColor = Color.Yellow;
				((DataGridView)(object)dgvFQ).Rows[rowIndex].ReadOnly = true;
			}
			int i;
			for (i = 2; i < ((DataGridView)(object)dgvFQ).Columns.Count; i++)
			{
				IEnumerable<double> tmp = from standard in experiment.StdConcentration
					where standard.sample == Convert.ToInt32(((DataGridView)(object)dgvFQ).Columns[i].Tag) && standard.symbol == headertext
					select standard.concentration;
				if (tmp != null && tmp.Count() > 0)
				{
					((DataGridView)(object)dgvFQ)[i, rowIndex].Value = tmp.ElementAt(0);
				}
				else
				{
					((DataGridView)(object)dgvFQ)[i, rowIndex].Value = 5;
				}
			}
		}
	}

	public string ExportStrAlpha(string symbol)
	{
		return Regex.Replace(symbol, "[0-9]", "", RegexOptions.IgnoreCase);
	}

	private void InitFQHeader()
	{
		((DataGridView)(object)dgvFQ).Columns.Clear();
		((DataGridView)(object)dgvFQ).Rows.Clear();
		((DataGridView)(object)dgvFQ).AllowUserToAddRows = false;
		((DataGridView)(object)dgvFQ).AllowUserToDeleteRows = false;
		if (experiment.Isotopes.Where((IsotopeInfos isotope) => isotope.method == 1).Count() == 0)
		{
			return;
		}
		int colIndex = ((DataGridView)(object)dgvFQ).Columns.Add("colFQNumber", Lang.Txt("FormConcentration.Columns.Seq.Text"));
		((DataGridView)(object)dgvFQ).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvFQ).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvFQ).Columns[colIndex].Width = 80;
		((DataGridView)(object)dgvFQ).Columns[colIndex].Visible = false;
		colIndex = ((DataGridView)(object)dgvFQ).Columns.Add("colFQLabel", Lang.Txt("FormConcentration.Columns.Label.Text"));
		((DataGridView)(object)dgvFQ).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvFQ).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvFQ).Columns[colIndex].Width = 80;
		foreach (IsotopeInfos isotope2 in experiment.Isotopes)
		{
			if (isotope2.method != 1)
			{
				continue;
			}
			bool IsExist = false;
			foreach (DataGridViewColumn col in ((DataGridView)(object)dgvFQ).Columns)
			{
				if (ExportStrAlpha(isotope2.symbol).Equals(col.HeaderText))
				{
					IsExist = true;
					break;
				}
			}
			if (!IsExist)
			{
				string headertext = Regex.Replace(isotope2.symbol, "[0-9]", "", RegexOptions.IgnoreCase);
				string name = "colFQ" + headertext;
				colIndex = ((DataGridView)(object)dgvFQ).Columns.Add(name, headertext);
				if (isotope2.inter)
				{
					((DataGridView)(object)dgvFQ).Columns[colIndex].DefaultCellStyle.BackColor = Color.Yellow;
					((DataGridView)(object)dgvFQ).Columns[colIndex].ReadOnly = true;
				}
				((DataGridView)(object)dgvFQ).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
				((DataGridView)(object)dgvFQ).Columns[colIndex].Width = 80;
			}
		}
		int rowIndex = ((DataGridView)(object)dgvFQ).Rows.Add();
		int i;
		for (i = 2; i < ((DataGridView)(object)dgvFQ).Columns.Count; i++)
		{
			IEnumerable<string> units = from isotope in experiment.Isotopes
				where isotope.symbol.Contains(((DataGridView)(object)dgvFQ).Columns[i].HeaderText)
				select isotope.units;
			if (units != null && units.Count() > 0)
			{
				((DataGridView)(object)dgvFQ)[i, rowIndex].Value = units.ElementAt(0);
			}
			else
			{
				((DataGridView)(object)dgvFQ)[i, rowIndex].Value = "ppb";
			}
			((DataGridView)(object)dgvFQ)[i, rowIndex].ReadOnly = true;
		}
	}

	private void BindFQConcentration()
	{
		if (((DataGridView)(object)dgvFQ).Columns.Count == 0)
		{
			return;
		}
		while (((DataGridView)(object)dgvFQ).Rows.Count > 1)
		{
			((DataGridView)(object)dgvFQ).Rows.RemoveAt(((DataGridView)(object)dgvFQ).Rows.Count - 1);
		}
		foreach (SamplesInfos sample in experiment.Samples)
		{
			if (sample.type != 1)
			{
				continue;
			}
			int rowIndex = ((DataGridView)(object)dgvFQ).Rows.Add();
			((DataGridView)(object)dgvFQ).Rows[rowIndex].Cells[0].Value = sample.guid;
			((DataGridView)(object)dgvFQ).Rows[rowIndex].Cells[1].Value = sample.label;
			if (CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvFQ).DefaultCellStyle.Font).Width > (float)((DataGridView)(object)dgvFQ).Columns[1].Width)
			{
				((DataGridView)(object)dgvFQ).Columns[1].Width = (int)CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvFQ).DefaultCellStyle.Font).Width;
			}
			int i;
			for (i = 2; i < ((DataGridView)(object)dgvFQ).Columns.Count; i++)
			{
				IEnumerable<double> tmp = from standard in experiment.StdConcentration
					where standard.sample == sample.guid && standard.symbol == ((DataGridView)(object)dgvFQ).Columns[i].HeaderText
					select standard.concentration;
				if (tmp != null && tmp.Count() > 0)
				{
					((DataGridView)(object)dgvFQ)[i, rowIndex].Value = tmp.ElementAt(0);
				}
				else
				{
					((DataGridView)(object)dgvFQ)[i, rowIndex].Value = 5;
				}
				if (CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvFQ)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvFQ).DefaultCellStyle.Font).Width > (float)(((DataGridView)(object)dgvFQ).Columns[i].Width - 5))
				{
					((DataGridView)(object)dgvFQ).Columns[i].Width = (int)CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvFQ)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvFQ).DefaultCellStyle.Font).Width + 5;
				}
			}
		}
	}

	private void BindSMConcentration()
	{
		if (((DataGridView)(object)dgvSM).Columns.Count == 0)
		{
			return;
		}
		while (((DataGridView)(object)dgvSM).Rows.Count > 1)
		{
			((DataGridView)(object)dgvSM).Rows.RemoveAt(((DataGridView)(object)dgvSM).Rows.Count - 1);
		}
		foreach (SamplesInfos sample in experiment.Samples)
		{
			if (sample.type != 5)
			{
				continue;
			}
			int rowIndex = ((DataGridView)(object)dgvSM).Rows.Add();
			((DataGridView)(object)dgvSM).Rows[rowIndex].Cells[0].Value = sample.guid;
			((DataGridView)(object)dgvSM).Rows[rowIndex].Cells[1].Value = sample.label;
			if (CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvSM).DefaultCellStyle.Font).Width > (float)((DataGridView)(object)dgvSM).Columns[1].Width)
			{
				((DataGridView)(object)dgvSM).Columns[1].Width = (int)CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvSM).DefaultCellStyle.Font).Width;
			}
			int i;
			for (i = 2; i < ((DataGridView)(object)dgvSM).Columns.Count; i++)
			{
				IEnumerable<double> tmp = from standard in experiment.StdConcentration
					where standard.sample == sample.guid && standard.symbol == ((DataGridView)(object)dgvSM).Columns[i].HeaderText
					select standard.concentration;
				if (tmp != null && tmp.Count() > 0)
				{
					((DataGridView)(object)dgvSM)[i, rowIndex].Value = tmp.ElementAt(0);
				}
				else
				{
					((DataGridView)(object)dgvSM)[i, rowIndex].Value = 5;
				}
				if (CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvSM)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvSM).DefaultCellStyle.Font).Width > (float)(((DataGridView)(object)dgvSM).Columns[i].Width - 5))
				{
					((DataGridView)(object)dgvSM).Columns[i].Width = (int)CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvSM)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvSM).DefaultCellStyle.Font).Width + 5;
				}
			}
		}
	}

	private void InitSMHeader()
	{
		((DataGridView)(object)dgvSM).Columns.Clear();
		((DataGridView)(object)dgvSM).Rows.Clear();
		((DataGridView)(object)dgvSM).AllowUserToAddRows = false;
		((DataGridView)(object)dgvSM).AllowUserToDeleteRows = false;
		if (experiment.Isotopes.Where((IsotopeInfos isotope) => isotope.method == 3).Count() == 0)
		{
			return;
		}
		int colIndex = ((DataGridView)(object)dgvSM).Columns.Add("colSMNumber", Lang.Txt("FormConcentration.Columns.Seq.Text"));
		((DataGridView)(object)dgvSM).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvSM).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvSM).Columns[colIndex].Width = 80;
		((DataGridView)(object)dgvSM).Columns[colIndex].Visible = false;
		colIndex = ((DataGridView)(object)dgvSM).Columns.Add("colSMLabel", Lang.Txt("FormConcentration.Columns.Label.Text"));
		((DataGridView)(object)dgvSM).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvSM).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvSM).Columns[colIndex].Width = 80;
		foreach (IsotopeInfos isotope2 in experiment.Isotopes)
		{
			if (isotope2.method != 3)
			{
				continue;
			}
			bool IsExist = false;
			foreach (DataGridViewColumn col in ((DataGridView)(object)dgvSM).Columns)
			{
				if (ExportStrAlpha(isotope2.symbol).Equals(col.HeaderText))
				{
					IsExist = true;
					break;
				}
			}
			if (!IsExist)
			{
				string headertext = Regex.Replace(isotope2.symbol, "[0-9]", "", RegexOptions.IgnoreCase);
				string name = "colSM" + headertext;
				colIndex = ((DataGridView)(object)dgvSM).Columns.Add(name, headertext);
				if (isotope2.inter)
				{
					((DataGridView)(object)dgvSM).Columns[colIndex].DefaultCellStyle.BackColor = Color.Yellow;
					((DataGridView)(object)dgvSM).Columns[colIndex].ReadOnly = true;
				}
				((DataGridView)(object)dgvSM).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
				((DataGridView)(object)dgvSM).Columns[colIndex].Width = 80;
			}
		}
		int rowIndex = ((DataGridView)(object)dgvSM).Rows.Add();
		int i;
		for (i = 2; i < ((DataGridView)(object)dgvSM).Columns.Count; i++)
		{
			IEnumerable<string> units = from isotope in experiment.Isotopes
				where isotope.symbol.Contains(((DataGridView)(object)dgvSM).Columns[i].HeaderText)
				select isotope.units;
			if (units != null && units.Count() > 0)
			{
				((DataGridView)(object)dgvSM)[i, rowIndex].Value = units.ElementAt(0);
			}
			else
			{
				((DataGridView)(object)dgvSM)[i, rowIndex].Value = "ppb";
			}
			((DataGridView)(object)dgvSM)[i, rowIndex].ReadOnly = true;
		}
	}

	private void InitSAHeader()
	{
		((DataGridView)(object)dgvSA).Columns.Clear();
		((DataGridView)(object)dgvSA).Rows.Clear();
		((DataGridView)(object)dgvSA).AllowUserToAddRows = false;
		((DataGridView)(object)dgvSA).AllowUserToDeleteRows = false;
		if (experiment.Isotopes.Where((IsotopeInfos isotope) => isotope.method == 2).Count() == 0)
		{
			return;
		}
		int colIndex = ((DataGridView)(object)dgvSA).Columns.Add("colSANumber", Lang.Txt("FormConcentration.Columns.Seq.Text"));
		((DataGridView)(object)dgvSA).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvSA).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvSA).Columns[colIndex].Width = 80;
		((DataGridView)(object)dgvSA).Columns[colIndex].Visible = false;
		colIndex = ((DataGridView)(object)dgvSA).Columns.Add("colSALabel", Lang.Txt("FormConcentration.Columns.Label.Text"));
		((DataGridView)(object)dgvSA).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvSA).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvSA).Columns[colIndex].Width = 80;
		foreach (IsotopeInfos isotope2 in experiment.Isotopes)
		{
			if (isotope2.method != 2)
			{
				continue;
			}
			bool IsExist = false;
			foreach (DataGridViewColumn col in ((DataGridView)(object)dgvSA).Columns)
			{
				if (ExportStrAlpha(isotope2.symbol).Equals(col.HeaderText))
				{
					IsExist = true;
					break;
				}
			}
			if (!IsExist)
			{
				string headertext = Regex.Replace(isotope2.symbol, "[0-9]", "", RegexOptions.IgnoreCase);
				string name = "colSA" + headertext;
				colIndex = ((DataGridView)(object)dgvSA).Columns.Add(name, headertext);
				if (isotope2.inter)
				{
					((DataGridView)(object)dgvSA).Columns[colIndex].DefaultCellStyle.BackColor = Color.Yellow;
					((DataGridView)(object)dgvSA).Columns[colIndex].ReadOnly = true;
				}
				((DataGridView)(object)dgvSA).Columns[colIndex].Width = 80;
				((DataGridView)(object)dgvSA).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
			}
		}
		int rowIndex = ((DataGridView)(object)dgvSA).Rows.Add();
		int i;
		for (i = 2; i < ((DataGridView)(object)dgvSA).Columns.Count; i++)
		{
			IEnumerable<string> units = from isotope in experiment.Isotopes
				where isotope.symbol.Contains(((DataGridView)(object)dgvSA).Columns[i].HeaderText)
				select isotope.units;
			if (units != null && units.Count() > 0)
			{
				((DataGridView)(object)dgvSA)[i, rowIndex].Value = units.ElementAt(0);
			}
			else
			{
				((DataGridView)(object)dgvSA)[i, rowIndex].Value = "ppb";
			}
			((DataGridView)(object)dgvSA)[i, rowIndex].ReadOnly = true;
		}
	}

	private void InitQCSHeader()
	{
		((DataGridView)(object)dgvQCS).Columns.Clear();
		((DataGridView)(object)dgvQCS).Rows.Clear();
		((DataGridView)(object)dgvQCS).AllowUserToAddRows = false;
		((DataGridView)(object)dgvQCS).AllowUserToDeleteRows = false;
		int colIndex = ((DataGridView)(object)dgvQCS).Columns.Add("colSANumber", Lang.Txt("FormConcentration.Columns.Seq.Text"));
		((DataGridView)(object)dgvQCS).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvQCS).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvQCS).Columns[colIndex].Width = 80;
		colIndex = ((DataGridView)(object)dgvQCS).Columns.Add("colSALabel", Lang.Txt("FormConcentration.Columns.Label.Text"));
		((DataGridView)(object)dgvQCS).Columns[colIndex].ReadOnly = true;
		((DataGridView)(object)dgvQCS).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		((DataGridView)(object)dgvQCS).Columns[colIndex].Width = 80;
		foreach (IsotopeInfos isotope in experiment.Isotopes)
		{
			string name = "colQCS" + isotope.symbol;
			colIndex = ((DataGridView)(object)dgvQCS).Columns.Add(name, isotope.symbol);
			if (isotope.inter)
			{
				((DataGridView)(object)dgvQCS).Columns[colIndex].DefaultCellStyle.BackColor = Color.Yellow;
				((DataGridView)(object)dgvQCS).Columns[colIndex].ReadOnly = true;
			}
			((DataGridView)(object)dgvQCS).Columns[colIndex].Width = 80;
			((DataGridView)(object)dgvQCS).Columns[colIndex].SortMode = DataGridViewColumnSortMode.NotSortable;
		}
	}

	private void BindSAConcentration()
	{
		if (((DataGridView)(object)dgvSA).Columns.Count == 0)
		{
			return;
		}
		while (((DataGridView)(object)dgvSA).Rows.Count > 1)
		{
			((DataGridView)(object)dgvSA).Rows.RemoveAt(((DataGridView)(object)dgvSA).Rows.Count - 1);
		}
		foreach (SamplesInfos sample in experiment.Samples)
		{
			if (sample.type != 2)
			{
				continue;
			}
			int rowIndex = ((DataGridView)(object)dgvSA).Rows.Add();
			((DataGridView)(object)dgvSA).Rows[rowIndex].Cells[0].Value = sample.guid;
			((DataGridView)(object)dgvSA).Rows[rowIndex].Cells[1].Value = sample.label;
			if (CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvSA).DefaultCellStyle.Font).Width > (float)((DataGridView)(object)dgvSA).Columns[1].Width)
			{
				((DataGridView)(object)dgvSA).Columns[1].Width = (int)CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvSA).DefaultCellStyle.Font).Width;
			}
			int i;
			for (i = 2; i < ((DataGridView)(object)dgvSA).Columns.Count; i++)
			{
				IEnumerable<double> tmp = from standard in experiment.StdConcentration
					where standard.sample == sample.guid && standard.symbol == ((DataGridView)(object)dgvSA).Columns[i].HeaderText
					select standard.concentration;
				if (tmp != null && tmp.Count() > 0)
				{
					((DataGridView)(object)dgvSA)[i, rowIndex].Value = tmp.ElementAt(0);
				}
				else
				{
					((DataGridView)(object)dgvSA)[i, rowIndex].Value = 5;
				}
				if (CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvSA)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvSA).DefaultCellStyle.Font).Width > (float)(((DataGridView)(object)dgvSA).Columns[i].Width - 5))
				{
					((DataGridView)(object)dgvSA).Columns[i].Width = (int)CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvSA)[i, rowIndex].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvSA).DefaultCellStyle.Font).Width + 5;
				}
			}
		}
	}

	private void BindQCSConcentration()
	{
		if (((DataGridView)(object)dgvQCS).Columns.Count == 0)
		{
			return;
		}
		Invoke((EventHandler)delegate
		{
			((DataGridView)(object)dgvQCS).Rows.Clear();
			foreach (SamplesInfos sample in experiment.Samples)
			{
				if (sample.type == 4)
				{
					int num = ((DataGridView)(object)dgvQCS).Rows.Add();
					((DataGridView)(object)dgvQCS).Rows[num].Cells[0].Value = sample.guid;
					((DataGridView)(object)dgvQCS).Rows[num].Cells[1].Value = sample.label;
					if (CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvQCS).DefaultCellStyle.Font).Width > (float)((DataGridView)(object)dgvQCS).Columns[1].Width)
					{
						((DataGridView)(object)dgvQCS).Columns[1].Width = (int)CreateGraphics().MeasureString(sample.label, ((DataGridView)(object)dgvQCS).DefaultCellStyle.Font).Width;
					}
					int i;
					for (i = 2; i < ((DataGridView)(object)dgvQCS).Columns.Count; i++)
					{
						IEnumerable<double> enumerable = from qcs in experiment.QCSConcentration
							where qcs.sample == sample.guid && qcs.symbol == ((DataGridView)(object)dgvQCS).Columns[i].HeaderText
							select qcs.concentration;
						if (enumerable != null && enumerable.Count() > 0)
						{
							((DataGridView)(object)dgvQCS)[i, num].Value = enumerable.ElementAt(0);
						}
						else
						{
							((DataGridView)(object)dgvQCS)[i, num].Value = 0;
						}
						if (CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvQCS)[i, num].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvQCS).DefaultCellStyle.Font).Width > (float)(((DataGridView)(object)dgvQCS).Columns[i].Width - 5))
						{
							((DataGridView)(object)dgvQCS).Columns[i].Width = (int)CreateGraphics().MeasureString(double.Parse(((DataGridView)(object)dgvQCS)[i, num].Value.ToString()).ToString("#.000"), ((DataGridView)(object)dgvQCS).DefaultCellStyle.Font).Width + 5;
						}
					}
				}
			}
		});
	}

	private void dgvFQ_CellMouseDownBak(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormConcentration.ApplyToOthers.Text"), delegate
			{
				string symbol = ((DataGridView)(object)dgvFQ).Rows[e.RowIndex].Cells[0].Value.ToString();
				ApplyColumns(1, symbol);
				BindFQConcentration();
			});
			menu.MenuItems.Add(Lang.Txt("FormConcentration.Copy.Text"), delegate
			{
				SendKeys.Send("^C");
			});
			MenuItem itemCopy = menu.MenuItems.Add(Lang.Txt("FormConcentration.Paste.Text"), delegate
			{
				PasteDatas((DataGridView)(object)dgvFQ);
			});
			itemCopy.Enabled = Clipboard.ContainsData(DataFormats.CommaSeparatedValue);
			Rectangle rect = ((DataGridView)(object)dgvFQ).GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, cutOverflow: true);
			menu.Show((Control)(object)dgvFQ, new Point(rect.X + e.X, rect.Y + e.Y));
			experiment.Dirty.STDConcDirty = true;
		}
	}

	private void dgvFQ_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormConcentration.ApplyToOthers.Text"), delegate
			{
				string headerText = ((DataGridView)(object)dgvFQ).Columns[e.ColumnIndex].HeaderText;
				ApplyColumns(1, headerText);
				BindFQConcentration();
			});
			menu.MenuItems.Add(Lang.Txt("FormConcentration.Copy.Text"), delegate
			{
				SendKeys.Send("^C");
			});
			MenuItem itemCopy = menu.MenuItems.Add(Lang.Txt("FormConcentration.Paste.Text"), delegate
			{
				PasteDatas((DataGridView)(object)dgvFQ);
			});
			itemCopy.Enabled = Clipboard.ContainsData(DataFormats.CommaSeparatedValue);
			Rectangle rect = ((DataGridView)(object)dgvFQ).GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, cutOverflow: true);
			menu.Show((Control)(object)dgvFQ, new Point(rect.X + e.X, rect.Y + e.Y));
			experiment.Dirty.STDConcDirty = true;
		}
	}

	private void dgvSM_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormConcentration.ApplyToOthers.Text"), delegate
			{
				string headerText = ((DataGridView)(object)dgvSM).Columns[e.ColumnIndex].HeaderText;
				ApplyColumns(3, headerText);
				BindSMConcentration();
			});
			menu.MenuItems.Add(Lang.Txt("FormConcentration.Copy.Text"), delegate
			{
				SendKeys.Send("^C");
			});
			MenuItem itemCopy = menu.MenuItems.Add(Lang.Txt("FormConcentration.Paste.Text"), delegate
			{
				PasteDatas((DataGridView)(object)dgvSM);
			});
			itemCopy.Enabled = Clipboard.ContainsData(DataFormats.CommaSeparatedValue);
			Rectangle rect = ((DataGridView)(object)dgvSM).GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, cutOverflow: true);
			menu.Show((Control)(object)dgvSM, new Point(rect.X + e.X, rect.Y + e.Y));
			experiment.Dirty.STDConcDirty = true;
		}
	}

	private void dgvSA_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormConcentration.ApplyToOthers.Text"), delegate
			{
				string headerText = ((DataGridView)(object)dgvSA).Columns[e.ColumnIndex].HeaderText;
				ApplyColumns(2, headerText);
				BindSAConcentration();
			});
			menu.MenuItems.Add(Lang.Txt("FormConcentration.Copy.Text"), delegate
			{
				SendKeys.Send("^C");
			});
			MenuItem itemCopy = menu.MenuItems.Add(Lang.Txt("FormConcentration.Paste.Text"), delegate
			{
				PasteDatas((DataGridView)(object)dgvSA);
			});
			itemCopy.Enabled = Clipboard.ContainsData(DataFormats.CommaSeparatedValue);
			Rectangle rect = ((DataGridView)(object)dgvSA).GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, cutOverflow: true);
			menu.Show((Control)(object)dgvSA, new Point(rect.X + e.X, rect.Y + e.Y));
			experiment.Dirty.STDConcDirty = true;
		}
	}

	private void ApplyColumns(int method, string symbol)
	{
		switch (method)
		{
		case 1:
		{
			foreach (SamplesInfos sample in experiment.Samples)
			{
				if (sample.type != method)
				{
					continue;
				}
				IEnumerable<double> value4 = from std in experiment.StdConcentration
					where std.symbol == symbol && std.sample == sample.guid
					select std.concentration;
				if (value4 == null || value4.Count() <= 0)
				{
					continue;
				}
				IEnumerable<StandardConcentration> stds4 = experiment.StdConcentration.Where((StandardConcentration std) => std.sample == sample.guid);
				foreach (StandardConcentration std5 in stds4)
				{
					std5.concentration = value4.First();
				}
			}
			break;
		}
		case 2:
		{
			foreach (SamplesInfos sample2 in experiment.Samples)
			{
				if (sample2.type != method)
				{
					continue;
				}
				IEnumerable<double> value3 = from std in experiment.StdConcentration
					where std.symbol == symbol && std.sample == sample2.guid
					select std.concentration;
				if (value3 == null || value3.Count() <= 0)
				{
					continue;
				}
				IEnumerable<StandardConcentration> stds3 = experiment.StdConcentration.Where((StandardConcentration std) => std.sample == sample2.guid);
				foreach (StandardConcentration std4 in stds3)
				{
					std4.concentration = value3.First();
				}
			}
			break;
		}
		case 3:
		{
			foreach (SamplesInfos sample3 in experiment.Samples)
			{
				if (sample3.type != 5)
				{
					continue;
				}
				IEnumerable<double> value2 = from std in experiment.StdConcentration
					where std.symbol == symbol && std.sample == sample3.guid
					select std.concentration;
				if (value2 == null || value2.Count() <= 0)
				{
					continue;
				}
				IEnumerable<StandardConcentration> stds2 = experiment.StdConcentration.Where((StandardConcentration std) => std.sample == sample3.guid);
				foreach (StandardConcentration std3 in stds2)
				{
					std3.concentration = value2.First();
				}
			}
			break;
		}
		case 4:
		{
			foreach (SamplesInfos sample4 in experiment.Samples)
			{
				if (sample4.type != method)
				{
					continue;
				}
				IEnumerable<double> value = from std in experiment.QCSConcentration
					where std.symbol == symbol && std.sample == sample4.guid
					select std.concentration;
				if (value == null || value.Count() <= 0)
				{
					continue;
				}
				IEnumerable<QCSConcentration> stds = experiment.QCSConcentration.Where((QCSConcentration std) => std.sample == sample4.guid);
				foreach (QCSConcentration std2 in stds)
				{
					std2.concentration = value.First();
				}
			}
			break;
		}
		}
	}

	private void dgvFQ_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			Cursor = Cursors.WaitCursor;
			DeleteStandard((DataGridView)(object)dgvFQ);
			BindFQConcentration();
			Cursor = Cursors.Arrow;
		}
		else if (e.Control && e.KeyCode == Keys.V && Clipboard.ContainsData(DataFormats.CommaSeparatedValue))
		{
			PasteDatas((DataGridView)(object)dgvFQ);
		}
	}

	private void DeleteStandardFQ(DataGridView dgv)
	{
		DataGridViewSelectedCellCollection selectedCells = ((DataGridView)(object)dgvFQ).SelectedCells;
		foreach (DataGridViewCell cell in dgv.SelectedCells)
		{
			if (cell.RowIndex > 0 && cell.ColumnIndex > 0)
			{
				int id = Convert.ToInt32(dgv.Columns[cell.ColumnIndex].Tag);
				string symbol = dgv.Rows[cell.RowIndex].Cells[0].Value.ToString();
				IEnumerable<StandardConcentration> tmp = experiment.StdConcentration.Where((StandardConcentration std) => std.symbol == symbol && std.sample == id);
				tmp.ElementAt(0).concentration = -1.0;
			}
		}
	}

	private void DeleteStandard(DataGridView dgv)
	{
		DataGridViewSelectedCellCollection selectedCells = ((DataGridView)(object)dgvFQ).SelectedCells;
		foreach (DataGridViewCell cell in dgv.SelectedCells)
		{
			if (cell.RowIndex > 0 && cell.ColumnIndex > 0)
			{
				int id = Convert.ToInt32(dgv[0, cell.RowIndex].Value);
				string symbol = dgv.Columns[cell.ColumnIndex].HeaderText;
				IEnumerable<StandardConcentration> tmp = experiment.StdConcentration.Where((StandardConcentration std) => std.symbol == symbol && std.sample == id);
				tmp.ElementAt(0).concentration = -1.0;
			}
		}
	}

	private void dgvSA_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			Cursor = Cursors.WaitCursor;
			DeleteStandard((DataGridView)(object)dgvSA);
			BindSAConcentration();
			Cursor = Cursors.Arrow;
		}
		if (e.Control && e.KeyCode == Keys.V)
		{
			PasteDatas((DataGridView)(object)dgvSA);
		}
		experiment.Dirty.STDConcDirty = true;
	}

	private void PasteDatas(DataGridView dgv)
	{
		try
		{
			DataGridViewSelectedCellCollection cells = dgv.SelectedCells;
			int rowIndex = 32767;
			int colIndex = 32767;
			foreach (DataGridViewCell cell in cells)
			{
				if (rowIndex > cell.RowIndex && cell.RowIndex > 0)
				{
					rowIndex = cell.RowIndex;
				}
				if (colIndex > cell.ColumnIndex)
				{
					colIndex = cell.ColumnIndex;
				}
			}
			string[] datas = Clipboard.GetData(DataFormats.CommaSeparatedValue).ToString().Split(new string[1] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
			if (datas != null && datas[0] == "System.IO.MemoryStream")
			{
				string pasteText = Clipboard.GetText();
				if (string.IsNullOrEmpty(pasteText))
				{
					return;
				}
				datas = pasteText.Trim().Split('\n');
			}
			string[][] cellDatas = new string[datas.Length][];
			for (int i = 0; i < datas.Length; i++)
			{
				string[] clips = datas[i].Split(',', '\t');
				cellDatas[i] = new string[clips.Length];
				for (int j = 0; j < clips.Length; j++)
				{
					cellDatas[i][j] = clips[j];
				}
			}
			for (int rowIdx = 0; rowIdx < datas.Length && rowIdx + rowIndex < dgv.RowCount; rowIdx++)
			{
				for (int colIdx = 0; colIdx < cellDatas[rowIdx].Length && colIdx + colIndex < dgv.ColumnCount; colIdx++)
				{
					try
					{
						double data = Convert.ToDouble(cellDatas[rowIdx][colIdx]);
						dgv[colIdx + colIndex, rowIdx + rowIndex].Value = data;
					}
					catch
					{
					}
				}
			}
		}
		catch
		{
		}
	}

	private void nudLow_ValueChanged(object sender, EventArgs e)
	{
		experiment.QCS.lowLimit = (double)nudLow.Value / 100.0;
	}

	private void nudHigh_ValueChanged(object sender, EventArgs e)
	{
		experiment.QCS.highLimit = (double)nudHigh.Value / 100.0;
	}

	private void rdBtnAuto_CheckedChanged(object sender, EventArgs e)
	{
		experiment.QCS.method = 0;
	}

	private void radioButton1_CheckedChanged(object sender, EventArgs e)
	{
		experiment.QCS.method = 1;
	}

	private void dgvQCS_CellValueChanged(object sender, DataGridViewCellEventArgs e)
	{
		int rowIndex = e.RowIndex;
		int colIndex = e.ColumnIndex;
		DataGridView dgv = sender as DataGridView;
		if (rowIndex >= 0 && colIndex > 1 && !dgv.Columns[colIndex].ReadOnly)
		{
			try
			{
				double value = Convert.ToDouble(dgv[colIndex, rowIndex].Value);
				int id = Convert.ToInt32(dgv[0, rowIndex].Value);
				string symbol = dgv.Columns[colIndex].HeaderText;
				IEnumerable<QCSConcentration> tmp = experiment.QCSConcentration.Where((QCSConcentration std) => std.symbol == symbol && std.sample == id);
				tmp.ElementAt(0).concentration = value;
				dgv[colIndex, rowIndex].Style.ForeColor = Color.Black;
			}
			catch
			{
				dgv[colIndex, rowIndex].Style.ForeColor = Color.Red;
			}
		}
		experiment.Dirty.STDConcDirty = true;
	}

	private void dgvQCS_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormConcentration.ApplyToOthers.Text"), delegate
			{
				string headerText = ((DataGridView)(object)dgvQCS).Columns[e.ColumnIndex].HeaderText;
				ApplyColumns(4, headerText);
				BindQCSConcentration();
			});
			menu.MenuItems.Add(Lang.Txt("FormConcentration.Copy.Text"), delegate
			{
				SendKeys.Send("^C");
			});
			MenuItem itemCopy = menu.MenuItems.Add(Lang.Txt("FormConcentration.Paste.Text"), delegate
			{
				PasteDatas((DataGridView)(object)dgvQCS);
			});
			itemCopy.Enabled = Clipboard.ContainsData(DataFormats.CommaSeparatedValue);
			Rectangle rect = ((DataGridView)(object)dgvQCS).GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, cutOverflow: true);
			menu.Show((Control)(object)dgvQCS, new Point(rect.X + e.X, rect.Y + e.Y));
			experiment.Dirty.STDConcDirty = true;
		}
	}

	private void dgvSM_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			Cursor = Cursors.WaitCursor;
			DeleteStandard((DataGridView)(object)dgvSM);
			BindSMConcentration();
			Cursor = Cursors.Arrow;
			experiment.Dirty.STDConcDirty = true;
		}
		else if (e.Control && e.KeyCode == Keys.V)
		{
			if (Clipboard.ContainsData(DataFormats.CommaSeparatedValue))
			{
				PasteDatas((DataGridView)(object)dgvSM);
			}
			experiment.Dirty.STDConcDirty = true;
		}
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected O, but got Unknown
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
		this.dgvSA = new DbufferGrid();
		this.tabControl1 = new System.Windows.Forms.TabControl();
		this.pageFQ = new System.Windows.Forms.TabPage();
		this.dgvFQ = new DbufferGrid();
		this.pageSA = new System.Windows.Forms.TabPage();
		this.pageQC = new System.Windows.Forms.TabPage();
		this.groupBox2 = new System.Windows.Forms.GroupBox();
		this.rdbtnManual = new System.Windows.Forms.RadioButton();
		this.rdBtnAuto = new System.Windows.Forms.RadioButton();
		this.gbQCCon = new System.Windows.Forms.GroupBox();
		this.dgvQCS = new DbufferGrid();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.nudHigh = new System.Windows.Forms.NumericUpDown();
		this.label2 = new System.Windows.Forms.Label();
		this.nudLow = new System.Windows.Forms.NumericUpDown();
		this.label1 = new System.Windows.Forms.Label();
		this.pageSM = new System.Windows.Forms.TabPage();
		this.dgvSM = new DbufferGrid();
		((System.ComponentModel.ISupportInitialize)this.dgvSA).BeginInit();
		this.tabControl1.SuspendLayout();
		this.pageFQ.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvFQ).BeginInit();
		this.pageSA.SuspendLayout();
		this.pageQC.SuspendLayout();
		this.groupBox2.SuspendLayout();
		this.gbQCCon.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvQCS).BeginInit();
		this.groupBox1.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.nudHigh).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudLow).BeginInit();
		this.pageSM.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvSM).BeginInit();
		base.SuspendLayout();
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).AllowUserToOrderColumns = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).DefaultCellStyle = dataGridViewCellStyle5;
		((System.Windows.Forms.Control)(object)this.dgvSA).Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvSA.HorCopy = false;
		((System.Windows.Forms.Control)(object)this.dgvSA).Location = new System.Drawing.Point(4, 4);
		((System.Windows.Forms.Control)(object)this.dgvSA).Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		((System.Windows.Forms.Control)(object)this.dgvSA).Name = "dgvSA";
		dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).RowTemplate.Height = 23;
		((System.Windows.Forms.Control)(object)this.dgvSA).Size = new System.Drawing.Size(1008, 552);
		((System.Windows.Forms.Control)(object)this.dgvSA).TabIndex = 1;
		this.dgvSA.VerCopy = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(dgvStdConcentration_CellFormatting);
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).CellLeave += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellLeave);
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dgvSA_CellMouseDown);
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellValueChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvSA).CurrentCellChanged += new System.EventHandler(dgvStdConcentration_CurrentCellChanged);
		((System.Windows.Forms.Control)(object)this.dgvSA).KeyDown += new System.Windows.Forms.KeyEventHandler(dgvSA_KeyDown);
		this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Bottom;
		this.tabControl1.Controls.Add(this.pageFQ);
		this.tabControl1.Controls.Add(this.pageSA);
		this.tabControl1.Controls.Add(this.pageQC);
		this.tabControl1.Controls.Add(this.pageSM);
		this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tabControl1.Location = new System.Drawing.Point(0, 0);
		this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.tabControl1.Name = "tabControl1";
		this.tabControl1.SelectedIndex = 0;
		this.tabControl1.Size = new System.Drawing.Size(1024, 589);
		this.tabControl1.TabIndex = 2;
		this.pageFQ.Controls.Add((System.Windows.Forms.Control)(object)this.dgvFQ);
		this.pageFQ.Location = new System.Drawing.Point(4, 4);
		this.pageFQ.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageFQ.Name = "pageFQ";
		this.pageFQ.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageFQ.Size = new System.Drawing.Size(1016, 560);
		this.pageFQ.TabIndex = 0;
		this.pageFQ.Text = "全定量";
		this.pageFQ.UseVisualStyleBackColor = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).AllowUserToOrderColumns = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).DefaultCellStyle = dataGridViewCellStyle8;
		((System.Windows.Forms.Control)(object)this.dgvFQ).Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvFQ.HorCopy = false;
		((System.Windows.Forms.Control)(object)this.dgvFQ).Location = new System.Drawing.Point(4, 4);
		((System.Windows.Forms.Control)(object)this.dgvFQ).Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		((System.Windows.Forms.Control)(object)this.dgvFQ).Name = "dgvFQ";
		dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).RowTemplate.Height = 23;
		((System.Windows.Forms.Control)(object)this.dgvFQ).Size = new System.Drawing.Size(1008, 552);
		((System.Windows.Forms.Control)(object)this.dgvFQ).TabIndex = 2;
		this.dgvFQ.VerCopy = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(dgvStdConcentration_CellFormatting);
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).CellLeave += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellLeave);
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dgvFQ_CellMouseDown);
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellValueChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvFQ).CurrentCellChanged += new System.EventHandler(dgvStdConcentration_CurrentCellChanged);
		((System.Windows.Forms.Control)(object)this.dgvFQ).KeyDown += new System.Windows.Forms.KeyEventHandler(dgvFQ_KeyDown);
		this.pageSA.Controls.Add((System.Windows.Forms.Control)(object)this.dgvSA);
		this.pageSA.Location = new System.Drawing.Point(4, 4);
		this.pageSA.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageSA.Name = "pageSA";
		this.pageSA.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageSA.Size = new System.Drawing.Size(1016, 560);
		this.pageSA.TabIndex = 1;
		this.pageSA.Text = "标准加入";
		this.pageSA.UseVisualStyleBackColor = true;
		this.pageQC.Controls.Add(this.groupBox2);
		this.pageQC.Controls.Add(this.gbQCCon);
		this.pageQC.Controls.Add(this.groupBox1);
		this.pageQC.Location = new System.Drawing.Point(4, 4);
		this.pageQC.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageQC.Name = "pageQC";
		this.pageQC.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.pageQC.Size = new System.Drawing.Size(1016, 560);
		this.pageQC.TabIndex = 2;
		this.pageQC.Text = "QC设置";
		this.pageQC.UseVisualStyleBackColor = true;
		this.groupBox2.Controls.Add(this.rdbtnManual);
		this.groupBox2.Controls.Add(this.rdBtnAuto);
		this.groupBox2.Location = new System.Drawing.Point(523, 1);
		this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox2.Name = "groupBox2";
		this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox2.Size = new System.Drawing.Size(397, 81);
		this.groupBox2.TabIndex = 5;
		this.groupBox2.TabStop = false;
		this.groupBox2.Text = "超限处理";
		this.rdbtnManual.AutoSize = true;
		this.rdbtnManual.Checked = true;
		this.rdbtnManual.Location = new System.Drawing.Point(191, 31);
		this.rdbtnManual.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.rdbtnManual.Name = "rdbtnManual";
		this.rdbtnManual.Size = new System.Drawing.Size(118, 19);
		this.rdbtnManual.TabIndex = 5;
		this.rdbtnManual.TabStop = true;
		this.rdbtnManual.Text = "等待用户确认";
		this.rdbtnManual.UseVisualStyleBackColor = true;
		this.rdbtnManual.CheckedChanged += new System.EventHandler(radioButton1_CheckedChanged);
		this.rdBtnAuto.AutoSize = true;
		this.rdBtnAuto.Location = new System.Drawing.Point(33, 32);
		this.rdBtnAuto.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.rdBtnAuto.Name = "rdBtnAuto";
		this.rdBtnAuto.Size = new System.Drawing.Size(118, 19);
		this.rdBtnAuto.TabIndex = 4;
		this.rdBtnAuto.Text = "自动添加标准";
		this.rdBtnAuto.UseVisualStyleBackColor = true;
		this.rdBtnAuto.CheckedChanged += new System.EventHandler(rdBtnAuto_CheckedChanged);
		this.gbQCCon.Controls.Add((System.Windows.Forms.Control)(object)this.dgvQCS);
		this.gbQCCon.Location = new System.Drawing.Point(11, 92);
		this.gbQCCon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.gbQCCon.Name = "gbQCCon";
		this.gbQCCon.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.gbQCCon.Size = new System.Drawing.Size(988, 449);
		this.gbQCCon.TabIndex = 2;
		this.gbQCCon.TabStop = false;
		this.gbQCCon.Text = "QC浓度";
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).AllowUserToOrderColumns = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).DefaultCellStyle = dataGridViewCellStyle11;
		((System.Windows.Forms.Control)(object)this.dgvQCS).Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvQCS.HorCopy = false;
		((System.Windows.Forms.Control)(object)this.dgvQCS).Location = new System.Drawing.Point(4, 22);
		((System.Windows.Forms.Control)(object)this.dgvQCS).Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		((System.Windows.Forms.Control)(object)this.dgvQCS).Name = "dgvQCS";
		dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).RowHeadersDefaultCellStyle = dataGridViewCellStyle12;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).RowTemplate.Height = 23;
		((System.Windows.Forms.Control)(object)this.dgvQCS).Size = new System.Drawing.Size(980, 423);
		((System.Windows.Forms.Control)(object)this.dgvQCS).TabIndex = 3;
		this.dgvQCS.VerCopy = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dgvQCS_CellMouseDown);
		((System.Windows.Forms.DataGridView)(object)this.dgvQCS).CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvQCS_CellValueChanged);
		this.groupBox1.Controls.Add(this.nudHigh);
		this.groupBox1.Controls.Add(this.label2);
		this.groupBox1.Controls.Add(this.nudLow);
		this.groupBox1.Controls.Add(this.label1);
		this.groupBox1.Location = new System.Drawing.Point(11, 0);
		this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.groupBox1.Size = new System.Drawing.Size(497, 82);
		this.groupBox1.TabIndex = 1;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "QC范围";
		this.nudHigh.Location = new System.Drawing.Point(377, 31);
		this.nudHigh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.nudHigh.Maximum = new decimal(new int[4] { 200, 0, 0, 0 });
		this.nudHigh.Minimum = new decimal(new int[4] { 100, 0, 0, 0 });
		this.nudHigh.Name = "nudHigh";
		this.nudHigh.Size = new System.Drawing.Size(99, 25);
		this.nudHigh.TabIndex = 3;
		this.nudHigh.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudHigh.Value = new decimal(new int[4] { 120, 0, 0, 0 });
		this.nudHigh.ValueChanged += new System.EventHandler(nudHigh_ValueChanged);
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(299, 38);
		this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(69, 15);
		this.label2.TabIndex = 2;
		this.label2.Text = "高限(%):";
		this.nudLow.Location = new System.Drawing.Point(156, 31);
		this.nudLow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		this.nudLow.Name = "nudLow";
		this.nudLow.Size = new System.Drawing.Size(99, 25);
		this.nudLow.TabIndex = 1;
		this.nudLow.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudLow.Value = new decimal(new int[4] { 80, 0, 0, 0 });
		this.nudLow.ValueChanged += new System.EventHandler(nudLow_ValueChanged);
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(77, 38);
		this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(69, 15);
		this.label1.TabIndex = 0;
		this.label1.Text = "低限(%):";
		this.pageSM.Controls.Add((System.Windows.Forms.Control)(object)this.dgvSM);
		this.pageSM.Location = new System.Drawing.Point(4, 4);
		this.pageSM.Name = "pageSM";
		this.pageSM.Padding = new System.Windows.Forms.Padding(3);
		this.pageSM.Size = new System.Drawing.Size(1016, 560);
		this.pageSM.TabIndex = 3;
		this.pageSM.Text = "半定量";
		this.pageSM.UseVisualStyleBackColor = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).AllowUserToOrderColumns = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).DefaultCellStyle = dataGridViewCellStyle3;
		((System.Windows.Forms.Control)(object)this.dgvSM).Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvSM.HorCopy = false;
		((System.Windows.Forms.Control)(object)this.dgvSM).Location = new System.Drawing.Point(3, 3);
		((System.Windows.Forms.Control)(object)this.dgvSM).Margin = new System.Windows.Forms.Padding(4);
		((System.Windows.Forms.Control)(object)this.dgvSM).Name = "dgvSM";
		dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).RowTemplate.Height = 23;
		((System.Windows.Forms.Control)(object)this.dgvSM).Size = new System.Drawing.Size(1010, 554);
		((System.Windows.Forms.Control)(object)this.dgvSM).TabIndex = 3;
		this.dgvSM.VerCopy = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(dgvStdConcentration_CellFormatting);
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).CellLeave += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellLeave);
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dgvSM_CellMouseDown);
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvStdConcentration_CellValueChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvSM).CurrentCellChanged += new System.EventHandler(dgvStdConcentration_CurrentCellChanged);
		((System.Windows.Forms.Control)(object)this.dgvSM).KeyDown += new System.Windows.Forms.KeyEventHandler(dgvSM_KeyDown);
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1024, 589);
		base.Controls.Add(this.tabControl1);
		base.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
		base.Name = "FormConcentration";
		base.ShowIcon = false;
		this.Text = "FormConcentration";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormConcentration_FormClosing);
		base.Load += new System.EventHandler(FormConcentration_Load);
		((System.ComponentModel.ISupportInitialize)this.dgvSA).EndInit();
		this.tabControl1.ResumeLayout(false);
		this.pageFQ.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvFQ).EndInit();
		this.pageSA.ResumeLayout(false);
		this.pageQC.ResumeLayout(false);
		this.groupBox2.ResumeLayout(false);
		this.groupBox2.PerformLayout();
		this.gbQCCon.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvQCS).EndInit();
		this.groupBox1.ResumeLayout(false);
		this.groupBox1.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.nudHigh).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudLow).EndInit();
		this.pageSM.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvSM).EndInit();
		base.ResumeLayout(false);
	}
}
